/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.mybatis.model;

import java.util.Properties;
import org.netbeans.api.db.explorer.JDBCDriver;

/**
 *
 * @author ProjetGWTPhp
 */
public class DBConnection {
    private String dataBaseURL;
    private Properties props;
    private JDBCDriver driver;
    private String DataBase;
    public DBConnection(String dataBaseURL, Properties props, JDBCDriver driver) {
        this.dataBaseURL = dataBaseURL;
        this.props = props;
        this.driver = driver;
    }

    public DBConnection(org.netbeans.modules.db.explorer.DatabaseConnection DBCn) {
        this.dataBaseURL = DBCn.getDatabase();
        this.props= new Properties();
        this.props.put("user", DBCn.getUser());
        this.props.put("password", DBCn.getPassword());
        this.driver = DBCn.findJDBCDriver();
        this.DataBase=DBCn.getDefaultSchema();
    }

    public String getDataBase() {
        return DataBase;
    }

    public String getDataBaseURL() {
        return dataBaseURL;
    }

    public Properties getProps() {
        return props;
    }

    public JDBCDriver getDriver() {
        return driver;
    }
    
    @Override
    public String  toString (){
    return this.getDataBaseURL();
    }
}
